package com.dems.admin.controller;

import com.dems.domain.DeviceModelReqVO;
import com.dems.domain.JsonResponse;
import com.dems.service.AsyncDeviceService;
import com.dems.service.DeviceModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/deviceModel")
public class DeviceModelController {

    @Autowired
    private DeviceModelService deviceModelService;

    @Autowired
    private AsyncDeviceService asyncDeviceService;

    @PostMapping("/find")
    public JsonResponse findByPage(@RequestBody DeviceModelReqVO reqVO){
        return JsonResponse.success(deviceModelService.queryListByPage(reqVO));
    }

    @PostMapping("/refresh")
    public JsonResponse refreshDeviceModel(){
        asyncDeviceService.asyncDeviceModel();
        return JsonResponse.success();
    }
}
